home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / kcl / kcl.lha / c / unixsys.c < prev    next >
C/C++ Source or Header  |  1987-06-04  |  1KB  |  62 lines

  1. /*
  2. (c) Copyright Taiichi Yuasa and Masami Hagiya, 1984.  All rights reserved.
  3. Copying of this file is authorized to users who have executed the true and
  4. proper "License Agreement for Kyoto Common LISP" with SIGLISP.
  5. */
  6.  
  7. #include "include.h"
  8.  
  9. #ifdef ATT
  10. #include <signal.h>
  11. int
  12. system(command)
  13. char *command;
  14. {
  15.     char buf[4];
  16.     extern sigint();
  17.  
  18.     signal(SIGINT, SIG_IGN);
  19.     write(4, command, strlen(command)+1);
  20.     read(5, buf, 1);
  21.     signal(SIGINT, sigint);
  22.     return(buf[0]<<8);
  23. }
  24. #endif
  25.  
  26. #ifdef E15
  27. #include <signal.h>
  28. int
  29. system(command)
  30. char *command;
  31. {
  32.     char buf[4];
  33.     extern sigint();
  34.  
  35.     signal(SIGINT, SIG_IGN);
  36.     write(4, command, strlen(command)+1);
  37.     read(5, buf, 1);
  38.     signal(SIGINT, sigint);
  39.     return(buf[0]<<8);
  40. }
  41. #endif
  42.  
  43. Lsystem()
  44. {
  45.     char command[1024];
  46.     int i;
  47.  
  48.     check_arg(1);
  49.     check_type_string(&vs_base[0]);
  50.     if (vs_base[0]->st.st_fillp >= 1024)
  51.         FEerror("Too long command line: ~S.", 1, vs_base[0]);
  52.     for (i = 0;  i < vs_base[0]->st.st_fillp;  i++)
  53.         command[i] = vs_base[0]->st.st_self[i];
  54.     command[i] = '\0';
  55.     vs_base[0] = make_fixnum(system(command) >> 8);
  56. }
  57.  
  58. init_unixsys()
  59. {
  60.     make_function("SYSTEM", Lsystem);
  61. }
  62.